﻿using System;
using System.Collections.Generic;
using System.Text;
using AbpDemo.Domain.Orders;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace AbpDemo.FluentConfigurations
{
    public class OrderItemConfiguration: IEntityTypeConfiguration<OrderItem_1>
    {
        public void Configure(EntityTypeBuilder<OrderItem_1> builder)
        {
            builder.ToTable("OrderItems");
            builder.HasKey(t => t.Id);
            builder.Property(t => t.Id).ValueGeneratedOnAdd();

            builder.Property(t => t.OrderId).IsRequired();
            builder.HasOne(t => t.Goods);
            builder.Property(t => t.Amount).IsRequired();
            builder.Property(t => t.SumAmount).IsRequired();
        }
    }
}
